/* Modern Upload CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    word-break: break-word;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.main-content {
    display: grid;
    gap: 30px;
    width: 100%;
}

/* Upload Section */
.upload-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    width: 100%;
    box-sizing: border-box;
}

.upload-header {
    margin-bottom: 30px;
}

.upload-header h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 15px;
    word-break: break-word;
}

.file-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f8f9fa;
    border-radius: 25px;
    font-size: 0.9rem;
    color: #6c757d;
    min-width: 0;
    flex-shrink: 1;
    word-break: break-word;
}

.icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Upload Zone */
.upload-zone {
    border: 3px dashed #ddd;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #fafafa;
    width: 100%;
    box-sizing: border-box;
}

.upload-zone:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-zone.dragover {
    border-color: #667eea;
    background: #e8f2ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

.upload-text h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #2c3e50;
    word-break: break-word;
}

.upload-text p {
    color: #6c757d;
    font-size: 1.1rem;
    word-break: break-word;
}

.browse-link {
    color: #667eea;
    text-decoration: underline;
    cursor: pointer;
}

/* Upload Options */
.upload-options {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-shrink: 1;
}

.info-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    color: #1976d2;
    font-size: 0.9rem;
    word-break: break-word;
    min-width: 0;
    flex-shrink: 1;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
}

.checkbox-label input {
    margin-right: 8px;
    transform: scale(1.2);
}

.checkmark {
    margin-left: 5px;
}

input[type="range"] {
    width: 120px;
    margin: 0 10px;
}

#qualityValue {
    font-weight: bold;
    color: #667eea;
}

/* File List */
.file-list {
    margin-bottom: 30px;
    width: 100%;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 10px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.file-item:hover {
    background: #e9ecef;
}

.file-preview {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    margin-right: 15px;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    overflow: hidden;
    flex-shrink: 0;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.file-info-item {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.file-details {
    font-size: 0.9rem;
    color: #6c757d;
    word-break: break-word;
}

.file-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: 5px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    word-break: break-word;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

.upload-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

/* Progress Section */
.progress-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    width: 100%;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    min-width: 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    border-radius: 5px;
}

.progress-text {
    font-weight: bold;
    color: #667eea;
    min-width: 50px;
    flex-shrink: 0;
}

.progress-details {
    font-size: 0.9rem;
    color: #6c757d;
    word-break: break-word;
}

/* File Management */
.file-management {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
}

.management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}

.management-header h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    word-break: break-word;
}

.file-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.file-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    width: 100%;
    box-sizing: border-box;
}

.file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-color: #667eea;
    background: #ffffff;
}

.file-card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: #e9ecef;
    border-radius: 10px;
    flex-shrink: 0;
}

.file-card-info {
    flex: 1;
    text-align: left;
    min-width: 0;
    overflow: hidden;
}

.file-card-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.4;
}

.file-card-details {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.3;
    word-break: break-word;
}

.file-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: calc(100vw - 40px);
    box-sizing: border-box;
    word-break: break-word;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

.toast.info {
    background: #17a2b8;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        width: 100%;
        max-width: 100%;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .upload-section,
    .file-management,
    .progress-section {
        padding: 20px 15px;
        margin: 10px 0;
    }

    .upload-zone {
        padding: 30px 15px;
    }

    .upload-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .file-info {
        gap: 10px;
    }

    .info-item {
        padding: 6px 12px;
        font-size: 0.8rem;
        flex: 1;
        min-width: 0;
    }

    .info-notice {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .management-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .management-header h2 {
        font-size: 1.5rem;
    }

    .file-grid {
        gap: 10px;
    }

    .file-card {
        padding: 12px 16px;
        gap: 12px;
    }

    .file-card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .file-card-actions {
        flex-direction: column;
        gap: 6px;
    }

    .btn-small {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .upload-actions {
        flex-direction: column;
        gap: 10px;
    }

    .toast {
        right: 10px;
        left: 10px;
        max-width: calc(100vw - 20px);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .upload-section,
    .file-management,
    .progress-section {
        padding: 15px 10px;
    }

    .upload-zone {
        padding: 20px 10px;
    }

    .upload-text h3 {
        font-size: 1.2rem;
    }

    .upload-text p {
        font-size: 1rem;
    }

    .file-info {
        gap: 8px;
    }

    .info-item {
        padding: 5px 10px;
        font-size: 0.75rem;
        flex: 1;
        min-width: 0;
    }

    .info-notice {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .file-grid {
        gap: 8px;
    }

    .file-card {
        padding: 10px 12px;
        gap: 10px;
    }

    .file-card-icon {
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
    }

    .file-card-name {
        font-size: 0.9rem;
    }

    .file-card-details {
        font-size: 0.8rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .btn-small {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .toast {
        right: 5px;
        left: 5px;
        max-width: calc(100vw - 10px);
        font-size: 0.9rem;
        padding: 12px 16px;
    }
}

@media (max-width: 320px) {
    .container {
        padding: 3px;
    }

    .header h1 {
        font-size: 1.3rem;
    }

    .upload-section,
    .file-management,
    .progress-section {
        padding: 12px 8px;
    }

    .upload-zone {
        padding: 15px 8px;
    }

    .upload-text h3 {
        font-size: 1.1rem;
    }

    .upload-text p {
        font-size: 0.9rem;
    }

    .file-info {
        gap: 6px;
    }

    .info-item {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    .info-notice {
        padding: 5px 8px;
        font-size: 0.7rem;
    }

    .file-card {
        padding: 8px 10px;
        gap: 8px;
    }

    .file-card-icon {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }

    .file-card-name {
        font-size: 0.85rem;
    }

    .file-card-details {
        font-size: 0.75rem;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .btn-small {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
}
